package com.design.动态代理;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author: sun.hongliang
 * @create: 2019/08/16 11:21
 */
public class DynamicHandler<T> implements InvocationHandler {
    private T t;

    public DynamicHandler(T t) {
        this.t = t;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("start ...");
        Object invoke = method.invoke(t, args);
        System.out.println("end ...");
        return invoke;
    }
}
